#include<iostream>
#include<memory>

typedef enum
{
    HAIER_TV,HISENSE_TV
}TV_t;

class TV
{

   public: virtual void play_TV() const{};
};

class HaierTV:public TV
{
    public:void play_TV()const{std::cout << "HarerTV is playing." << std::endl;};
};

class HisenseTV:public TV
{
    public:void play_TV()const{std::cout << "HisenseTV is playing." << std::endl;};
};

class FactoryTV
{

    public:std::shared_ptr<TV> createTV(TV_t tv)
    {
        switch (tv)
        {
        case HAIER_TV:
            return std::make_shared<HaierTV>();
            break;
         case HISENSE_TV:
            return std::make_shared<HisenseTV>();
            break;
        
        default:
            throw("nonting of TV");
            break;
        }
    }
};

int main(int argc, char const *argv[])
{
    FactoryTV fa;
    try
    {
        std::shared_ptr<TV> tv = fa.createTV(static_cast<TV_t>(2));
        tv->play_TV();
    }
    catch(const char* msg)
    {
        std::cerr << msg << '\n';
    }
    
    
    return 0;
}
